package com.laoxu.test.sqlitedemo.service;

import com.laoxu.test.sqlitedemo.mapper.UserDao;
import com.laoxu.test.sqlitedemo.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.jws.soap.SOAPBinding;
import java.util.List;

/**
 * @Description:
 * @Author laoxu
 * @Date 2019/11/5 23:10
 **/
@Service
public class UserService {
    @Autowired
    private UserDao userDao;

    public boolean add(User user) {
        return userDao.insert(user) > 0;
    }

    public User getOne(int id) {
        return userDao.select(id);
    }

    public List<User> getAll() {
        return userDao.selectAll();
    }

    public boolean modify(User user) {
        return userDao.update(user) > 0;
    }

    public boolean remove(Integer id) {
        return userDao.delete(id) > 0;
    }


}
